package com.leyou.item.service.impl;

import com.leyou.common.dto.PageDTO;
import com.leyou.item.dto.SkuDTO;
import com.leyou.item.dto.SpecParamDTO;
import com.leyou.item.dto.SpuDTO;
import com.leyou.item.dto.SpuDetailDTO;
import com.leyou.item.service.GoodsService;
import com.leyou.item.service.SkuService;
import com.leyou.item.service.SpuDetailService;
import com.leyou.item.service.SpuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author mySun
 * @create 2021-07-18 14:36
 */
@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    private SpuService spuService;
    @Autowired
    private SpuDetailService spuDetailService;
    @Autowired
    private SkuService skuService;

    @Override
    public PageDTO<SpuDTO> pageSpu(Long curPage, Long rows, Long bid, Long cid, Long sid, Boolean saleable) {
        return spuService.pageSpu(curPage,rows,bid,cid,sid,saleable);
    }

    @Override
    public void saveSpu(SpuDTO spuDTO) {
        spuService.saveSpu(spuDTO);
    }

    @Override
    public void updateSpuSaleable(Long sid, Boolean saleable) {
        spuService.updateSpuSaleable(sid,saleable);
    }

    @Override
    public SpuDTO queryGoodsById(Long id) {
        return spuService.queryGoodsById(id);
    }

    @Override
    public void updateSpu(SpuDTO spuDTO) {
        spuService.updateSpu(spuDTO);
    }

    @Override
    public SpuDetailDTO queryDetailBySid(Long sid) {
        return spuDetailService.queryDetailBySid(sid);
    }

    @Override
    public List<SkuDTO> listSkuBySid(Long sid) {
        return skuService.listSkuBySid(sid);
    }

    @Override
    public List<SkuDTO> listSkuBySkuIds(List<Long> skuIds) {
        return skuService.listSkuBySkuIds(skuIds);
    }

    @Override
    public List<SpecParamDTO> querySpecsValues(Long sid, Boolean isSearching) {
        return skuService.querySpecsValues(sid,isSearching );
    }

    @Override
    public SpuDTO querySpuById(Long sid) {
        return spuService.querySpuById(sid);
    }

}
